import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import TypeNav from '@/components/TypeNav';
import Carousel from "@/components/Carousel";
import Pagination from '@/components/Pagination'
// 引入mock
import "@/mock/mockServe";

//引入swiper样式
import "swiper/css/swiper.css";

//统一接口api文件夹里面全部请求函数
//统一引入
import * as API from '@/api';

import { Button,MessageBox} from 'element-ui';

Vue.config.productionTip = false


// 全局注册以下组件
Vue.component("TypeNav",TypeNav)
Vue.component(Carousel.name, Carousel);
Vue.component(Pagination.name,Pagination);

Vue.component(Button.name,Button);
//ElementUI注册组件的时候，还有一种写法，挂在原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;


import atm from '@/assets/1.gif';
//引入插件
import VueLazyload from 'vue-lazyload';
//注册插件
Vue.use(VueLazyload,{
  //懒加载默认的图片
  loading:atm
});


//引入表单校验插件
import "@/plugins/validate";

//
new Vue({
  //全局事件总线$bus配置
  beforeCreate() {
    //此处的this就是这个new Vue()对象
    //网络有很多bus通信总结，原理相同，换汤不换药
    Vue.prototype.$bus = this
    // api
    Vue.prototype.$API = API;
  },
  router,
  store,
  render: h => h(App)
}).$mount('#app')
